#region copyright 2005 jingstudio
/**
 Dev by alittlefish(jmtek)
 MSN: jing226@hotmail.com
 OICQ: 24417417
 Email: alittlefish2005@yahoo.com.cn 
 */
#endregion

#region Importing
using System;
using System.Drawing;
#endregion

namespace Jingstudio.WatermarkMaker.Watermark
{
	public class CustomedPosition : WatermarkPosition
	{
		#region Cstr
		public CustomedPosition()
		{
			this._x = -1;
			this._y = -1;
		}

		public CustomedPosition(PointF point)
		{
			this._x = point.X;
			this._y = point.Y;
		}
		#endregion

		public override RectangleF GetPosition(Size imageSize, Size watermarkSize)
		{
			float width = (float)watermarkSize.Width;
			float height = (float)watermarkSize.Height;

			if (this._x == -1 && this._y == -1)
			{
				float tWidth = (float)imageSize.Width;
				float tHeight = (float)imageSize.Height;

				this._x = (tWidth - width)/2;
				this._y = (tHeight - height)/2;
			}

			return new RectangleF (this._x, this._y, width, height);
		}
	}
}
